package com.gt.controller.admin;

import com.gt.pojo.Result;
import com.gt.pojo.vo.CategoryListVO;
import com.gt.pojo.vo.NewStudentsVO;
import com.gt.service.reportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.List;

@RestController
@RequestMapping("/admin/report")
@Api(tags = "数据统计相关接口")
public class ReportController {

    @Autowired
    private reportService reportService;


    @GetMapping("/userStatistics")
    @ApiOperation("用户统计接口")
    public Result<Integer> userStatistics(){
        Integer count = reportService.getUserStatistics();
        return Result.success(count);
    }
    @GetMapping("/borrowList")
    @ApiOperation("借阅统计接口")
    public Result<Integer> borrowList(){
        Integer count = reportService.getBorrowList();
        return Result.success(count);
    }
    @GetMapping("/categoryList")
    @ApiOperation("图书分类统计接口")
    public Result<List<CategoryListVO>> categoryList(){
        List<CategoryListVO> categoryListVO = reportService.getCategoryList();
        return Result.success(categoryListVO);
    }
    @GetMapping("/NewStudents")
    @ApiOperation("新增学生统计接口")
    public Result<List<NewStudentsVO>> getNewStudentsByDate(){
        List<NewStudentsVO> newStudentsVOS = reportService.getNewStudentsByDate();
        return Result.success(newStudentsVOS);
    }

}
